package com.ms.client.bizbase.file.service;

import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import com.ms.client.bizbase.file.pojo.FileInfo;
import com.ms.msclient.MsClient;
import com.ms.msclient.MsClientResponse;
import com.system.comm.model.Page;

/**
 * file_info的Service
 * @author jimmy
 * @date 2019-07-13 16:27:06
 * @version V1.0.0
 */
@MsClient(value="${service.id.biz-base}", defalut="biz-base")
public interface FileInfoService {
	/**
	 * 根据fileId获取对象
	 * @param fileId
	 * @return
	 */
	@RequestMapping(value = "/fileInfo/get")
	public MsClientResponse<FileInfo> get(@RequestParam("fileId")String fileId);

	/**
	 * 分页获取对象
	 * @param fileInfo
	 * @return
	 */
	@RequestMapping(value = "/fileInfo/pageQuery")
	public MsClientResponse<Page<FileInfo>> pageQuery(FileInfo fileInfo);
	
	/**
	 * 根据fileId删除对象
	 * @param fileId
	 * @return
	 */
	@RequestMapping(value = "/fileInfo/delete")
	public MsClientResponse<FileInfo> delete(@RequestParam("fileId")String fileId);
	/**
	 * 根据browseUrl获取对象
	 * @param browseUrl
	 * @return
	 */
	@RequestMapping(value = "/fileInfo/getByBrowseUrl")
	public MsClientResponse<FileInfo> getByBrowseUrl(@RequestParam("browseUrl")String browseUrl);
	/**
	 * 上传文件
	 * @param multipartFile
	 * @param fileInfo
	 * @return
	 */
	@RequestMapping(value = "/fileInfo/save", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
	public MsClientResponse<FileInfo> save(@RequestParam("file")MultipartFile multipartFile, FileInfo fileInfo);
	

	/**
	 * 下载文件
	 * @param url		文件访问的url路径
	 * @return
	 */
	@RequestMapping(value = "/fileInfo/download")
	public ResponseEntity<byte[]> download(@RequestParam("url")String url);
}